"""Srudyproject URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from .views import *
from django.urls import path
from rest_framework.routers import DefaultRouter
router = DefaultRouter()

# 添加用户
router.register('users', UserView)

# 获取、添加学校
router.register("schools", SchoolAPIView)

# 获取、添加班级
router.register('grades',GradeSet)

# 获取、添加学生
router.register('students', StudentSet)

urlpatterns = [
    # 登录
    path('login/', UserLogin.as_view()),
    # 获取图片验证码
    path("image_code/<uuid:uuid>/", ImgCode.as_view()),
    # 发送验证码
    path('sms_code/', SmsAPIView.as_view()),
    # 获取当前登录的用户
    path("info_list/",LoginRoleAPIView.as_view()),
    # 获取班级里的学生
    path("grade_teacher/", GradeTeacherAPIView.as_view()),
    # 获取登录问候语
    path("greetings/", GreetingsAPIView.as_view()),
    # 更改用户密码
    path("changepwd/<int:pk>/", ChangePwd.as_view()),
    # 修改学校
    path("school_olper/<int:pk>/", SchoolOper.as_view()),
    # 删除学校
    path("dropschool/<int:pk>/", DropSchool.as_view()),
    # 修改班级
    path("grade_oper/<int:pk>/",GradeOper.as_view()),
    # 忘记密码
    path("forget/", ForgetPwd.as_view()),

]
urlpatterns += router.urls
